﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace WebApplication_01
{
    public class Program
    {
        static string connString = "http://127.0.0.1:5000";
        public static void Main(string[] args)
        {
            //读配置
            IConfigurationBuilder builder = new ConfigurationBuilder()
                .SetBasePath(Directory.GetCurrentDirectory())
                .AddJsonFile("appsettings.json");
            IConfigurationRoot Configuration = builder.Build();

            connString = Configuration["Start:bindIP"];

            //构建Web宿主机
            IWebHost host = BuildWebHost(args);
            //开始启动
            host.Run();
        }

        public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args).UseUrls(connString)
                .UseStartup<Startup>()
                .Build();

    }
}
